Jupyter Set up on Window
This project will use Python 3.7 and configure virtual env files location. You can leave default location but there is some issue with disk space and we will need to customize virtual env files location.
#
Configure Python 3.7 on WindowDownlaod Python 3.7
If you already have previous virtual env files, they are located under "C:\Users\<YOUR_USERNAME>" by default and also need to delete from python relative files from "C:\Users\<YOUR_USERNAME>\AppData\Local\Programs and C:\Users\<YOUR_USERNAME>\AppData\Local\pip"
Recommend selecting that option and thereby removing the path length limit. It will potentially save you time in future on debugging an avoidable issue. Python 3.7 don't have.Confirm python installation by using the following command. If you don’t see any output, there need to config window environmental variables.
pip --version
#
Configure Jupyter on Window ( Client Mode )There are a lot of ways which can install Jupyter. We will use pip here to install Jupyter Notebook
pip install jupyterlab
After Jupyter is successfully installed, open the notebook running the following command.
YOUR_PATH jupyter notebook
where YOUR_PATH is the location you want to open the notebook.
#
Virtual Environment using “virtualenv”The main purpose of Python virtual environments is to create an isolated environment for Python projects. Each project can have its own dependencies, regardless of what dependencies every other project has. “Virtualenv” is the most popular library to create an isolated python environment. Install “Virtualenv” by running the following command.
pip install virtualenv
After the virtual environment is successfully installed, create the new virtual environment as below.
YOUR_PATH virtualenv <YOUR_ENV_NAME>YOUR_PATH virtualenv -p <python-path>/python2.7 <YOUR_ENV_NAME>
Tip: It is better to create under jupyter notebook
<YOUR_ENV_NAME> is the virtual environment’s name and we will use the created environment by using the name in future. All required dependencies are installed under that created name. The virtual environment needs to be activated manually.
YOUR_PATH <YOUR_ENV_NAME>/Scripts/activate.bat
If you successfully activate the virtual environment, the root dependencies lib will be changed as below.
#
Add Virtual Environment to Jupyter NotebookThat virtual environment needs to be accessed from the jupyter notebook so that we can best the isolated python environment on deployment. We need to install IPython Kernel.
pip install ipykernel
After the IPython kernel is successfully installed, we can add the virtual environment <YOUR_ENV_NAME> to the jupyter by using the following command.
python -m ipykernel install --user --name=<YOUR_ENV_NAME>
and then refresh the jupyter notebook page and we will see the <YOUR_ENV_NAME> as follows.
#
Jupyter is readyAfter adding the virtual environment to Jupyter, it is ready to write the code. We can create a new notebook by clicking on the targeted virtual environment.
Regards